<?php

use think\migration\Migrator;
use think\migration\db\Column;

class BasicInstrument extends Migrator
{
    /**
     * 数据采集器-简称数采仪
     */
    public function up()
    {
        $table = $this->table('basic_instrument');
        $table
            ->setComment('基本数据 - 数据采集仪')
            //step1：关联ID
            ->addColumn('region_id', 'integer', ['limit' => 11, 'default' => 53, 'comment' => '区域ID'])
            ->addColumn('name', 'string', ['limit' => 50, 'comment' => '数采仪名称'])
            ->addColumn('company_id', 'integer', ['limit' => 11, 'comment' => '公司ID'])
            ->addColumn('delete_time', 'integer', ['limit' => 11, 'default' => 0, 'comment' => '软删除'])
            //引擎
            ->setEngine('InnoDB')
            ->save();
    }

    public function down()
    {
        $this->table('basic_instrument')->drop();
    }
}
